package com.zy.cat.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.annotations.Api;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class Swagger2Config {
	
//	@Bean
//	public Docket PddMallApi() {
//		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫拼多多商城API-V1").apiInfo(zy9CatPddMallApiInfo()).select()
//				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
//				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.pdd.v1"))
//				.build();
//	}


	@Bean
	public Docket MallApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫商城API-V1").apiInfo(zy9CatMallApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.mall.v1"))
				.build();
	}

	@Bean
	public Docket GameApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫小游戏API-V1").apiInfo(zy9CatGameApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.game.v1"))
				.build();
	}
	@Bean
	public Docket ADApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫广告API-V1").apiInfo(zy9CatADApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.ad.v1"))
				.build();
	}
	
	@Bean
	public Docket DevApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫用户信息API-V1").apiInfo(zy9CatDevApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.dev.v1"))
				.build();
	}
	
	@Bean
	public Docket RunApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫走路赚钱API-V1").apiInfo(zy9CatRunApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.run.v1"))
				.build();
	}
	
	@Bean
	public Docket ToolApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫开放工具API-V1").apiInfo(zy9CatToolApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.v1"))
				.build();
	}
	
	@Bean
	public Docket AppApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫APP数据统计API-V1").apiInfo(zy9CatAppApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.app.v1"))
				.build();
	}
	
	@Bean
	public Docket AppAdApi() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("9趣猫APP广告数据统计API-V1").apiInfo(zy9CatAppAdApiInfo()).select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.apis(RequestHandlerSelectors.basePackage("com.zy.cat.controller.ad.v1"))
				.build();
	}
	
	private ApiInfo zy9CatAppAdApiInfo() {
		return new ApiInfoBuilder().title("9趣猫APP广告数据统计API接口文档").description("9趣猫APP，广告统计所有接口")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
	private ApiInfo zy9CatAppApiInfo() {
		return new ApiInfoBuilder().title("9趣猫APP数据统计API接口文档").description("9趣猫APP，PV、PU统计所有接口")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
	
	//测试服:https://api.jiuqumao.cn/test
	private ApiInfo zy9CatMallApiInfo() {
		return new ApiInfoBuilder().title("9趣猫淘客商城服务端API接口文档").description("9趣猫淘客商城API，商品列表以及高佣转链")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
//	private ApiInfo zy9CatPddMallApiInfo() {
//		return new ApiInfoBuilder().title("9趣猫拼多多商城服务端API接口文档").description("9趣猫拼多多商城API，商品列表以及高佣转链")
//				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
//				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
//	}
	
	private ApiInfo zy9CatGameApiInfo() {
		return new ApiInfoBuilder().title("9趣猫小游戏服务端API接口文档").description("9趣猫小游戏所有接口文档")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
	
	private ApiInfo zy9CatADApiInfo() {
		return new ApiInfoBuilder().title("9趣猫广告服务端API接口文档").description("9趣猫广告所有接口文档")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
	
	private ApiInfo zy9CatDevApiInfo() {
		return new ApiInfoBuilder().title("9趣猫用户信息服务端API接口文档").description("9趣猫用户信息所有接口文档")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
	
	private ApiInfo zy9CatRunApiInfo() {
		return new ApiInfoBuilder().title("9趣猫走路赚钱服务端API接口文档").description("9趣猫走路赚钱所有接口文档")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
	
	private ApiInfo zy9CatToolApiInfo() {
		return new ApiInfoBuilder().title("9趣猫开放工具API接口文档").description("9趣猫系统工具接口")
				.termsOfServiceUrl("正式服:https://api.jiuqumao.cn 测试服:https://test.jiuqumao.cn/")
				.contact(new Contact("Link", "505765656", "505765656@qq.com")).version("1.0.1").build();
	}
}
